package com.bytedance.controller;

import com.bytedance.dataobject.C;
import com.bytedance.model.Result;
import com.bytedance.service.CService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/C")
public class CController {

    @Autowired
    private CService cService;

    @PostMapping()
    public Result<C> add(@RequestBody C c) {
        return cService.add(c);
    }

    @PutMapping
    public Result<C> update(@RequestBody C c) throws Exception {
        return cService.update(c);
    }

    @GetMapping
    public Result<List<C>> getAll() {
        return cService.getAll();
    }

    @GetMapping("{b}")
    public Result<List<C>> getByB(@PathVariable String b) {
        return cService.getByB(b);
    }
}
